<!DOCTYPE html>
<html lang="en">

<!--****头部 star****-->
@include('Admin.Public.header')

<body>
<div class="wrapper scrollbar-inner">
    <div class="main-panel">

        <div class="content" style="margin-top: 20px;">
            <div class="page-inner">
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item active" aria-current="page">系统设置</li>
                        <li class="breadcrumb-item"><a href="javascript:window.history.go(-1);">基础设置</a></li>
                        <li class="breadcrumb-item active" aria-current="page">添加设置</li>
                    </ol>
                </nav>

                <div class="row">

                    <div class="col-md-12">
                        <div class="card">
                            <div class="card-header">
                                <div class="d-flex align-items-center">
                                    <h4 class="card-title">添加配置</h4>
                                </div>
                            </div>

                            <div class="table-responsive">
                                <div id="add-row_wrapper" class="dataTables_wrapper container-fluid dt-bootstrap4"
                                     style="margin-top: 5px;">

                                    <form id="form-data">
                                        <div class="form-group">
                                            <label for="exampleInputEmail1">配置名称</label>
                                            <input type="text" class="form-control" id="name" name="name" placeholder=""
                                                   max="100" value="" data-required="true" style="width: 40%;">
                                        </div>
                                        <div class="form-group">
                                            <label for="exampleInputEmail1">配置主键</label>
                                            <input type="text" class="form-control" id="key" name="key" placeholder=""
                                                   max="100"
                                                   value="" data-required="true" style="width: 40%;">
                                        </div>
                                        <div class="form-group">
                                            <label for="exampleInputEmail1">配置内容</label>
                                            <input type="text" class="form-control" id="value" name="value"
                                                   placeholder="" max="100"
                                                   value="" data-required="true" style="width: 90%;">
                                        </div>
                                        <div class="form-group">
                                            <button type="button" class="btn btn-primary"
                                                    onclick="add()">提交
                                            </button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>
</div>
</div>

@include('Admin.Public.footer')


<script type="text/javascript">
    /**
     * 添加
     * @param id
     */
    function add() {
        var data = $('#form-data').serialize();
        $.requestAjax({
            type: "post",
            url: "/myadmin/config/add",
            data: data,
            dataType: "json",
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            success: function (e) {
                swal("成功!", e.msg, {
                    icon: "success",
                    buttons: {
                        confirm: {
                            className: 'btn btn-success'
                        }
                    },
                }).then(function () {
                    window.history.go(0)
                });
            },
            error: function (e) {

            }
        });
    }

</script>
</body>
</html>